-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix stack overflow by enum and cont issue #36163 #38093
Conversation
Oh I was just helping to debug :) r? @arielb1 |
} | ||
} | ||
fn with_item_id_pushed<F>(&mut self, id: ast::NodeId, f: F, span: Span) | ||
where F: Fn(&mut Self) | ||
{ | ||
if self.opt_last_id.map_or(false, |last| last == id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be self.opt_last_id == Some(id)
, but what is this supposed to be doing?
if self.idstack.iter().any(|&x| x == id) { | ||
if self.detected_recursive_ids.contains(&id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this could be if let Some(..) = self.detected_recursive_ids.replace(id)
.
I think you can skip the exponential worst-case by removing |
r+ with the "removing visit_expr" change if that works. |
… were skipped while checking for recursion.
2c72813
to
b8d8ab8
Compare
@arielb1 I've just tested it works, but I thought I tested it before. I also removed RefCell, hope you don't mind. |
fix stack overflow by enum and cont issue #36163 some paths were skipped while checking for recursion. I fixed bug reproduces on win64 cargo test. In previous PR #36458 time complexity was exponential in case of linked const values. Now it's linear. r? @alexcrichton
some paths were skipped while checking for recursion.
I fixed bug reproduces on win64 cargo test. In previous PR #36458 time complexity was exponential in case of linked const values. Now it's linear.
r? @alexcrichton